<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function SuperType(name) {
      this.name = name
      this.colors = ['red','green','yellow']
    }
    SuperType.prototype.sayName = function() {
      return this.sayName
    }
    function SubType(name,age) {
      SuperType.call(this,name)
      this.age = age
    }
    SubType.prototype = new SuperType()
    SubType.prototype.sayAge = function() {
      console.log(this.age)
    }
    let instance1 = new SubType('will',24)
    instance1.colors.push('skyblue')
    let instance2 = new SubType('hehuan',23)
    console.log(instance2.colors)
    // 组合式继承（盗用构造函数基础和原型链继承结合版本），可以通过子类向父类构造函数传递参数
    // 子类也可以访问父类原型的属性和方法
  </script>
</body>
</html>